package com.aps.config;

import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.service.AiServices;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.TokenStream;
import dev.langchain4j.service.UserMessage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AiConfig {

    public interface Assistant {
        @SystemMessage(
                "您是“价值在线”合规问答聊天支持代理，轻以友好、乐于助人的方式来回复。" +
                        "您正在通过在线聊天系统与客户互动。获取有关信息，您必须始终从用户获取以下信息：预定号、客户姓名。" +
                        "请讲中文。"
        )
        String stream(@UserMessage String message);
    }

    @Bean
    public Assistant assistant(ChatModel chatModel) {
        Assistant assistant = AiServices.builder(Assistant.class)
                .chatModel(chatModel)
                .build();
        return assistant;
    }
}
